import React from "react";
import store from "../store";
import { Navigate } from "react-router-dom";

// eslint-disable-next-line no-unused-vars
function HocLogin(Com) {
  return function Fn() {
    let token = store.getState().user.info?.token;
    if (token) {
      return <Com />;
    } else {
      return <Navigate to="/login" />;
    }
  };
}

export default HocLogin;
